﻿using System.Data.SqlClient;

namespace dPet.Infrastructure.EntityFramework.Repositories
{
	using dPet.Domain.Models;
	using dPet.Domain.Repositories;
	using Hangerd.EntityFramework;
	using Hangerd.Repository;

	public class InventoryAlarmItemRepository : EfRepository<InventoryAlarmItem>, IInventoryAlarmItemRepository
	{
		public InventoryAlarmItemRepository(IRepositoryContext unitOfWork)
			: base(unitOfWork)
		{ }

		public void RemoveItemsByProductAndAlarmType(Product product, InventoryAlarmType alarmType)
		{
			base.ExecuteCommand("DELETE dbo.InventoryAlarmItem WHERE ProductId = @productId AND AlarmType = @alarmType",
				new SqlParameter("@productId", product.Id),
				new SqlParameter("@alarmType", (int)alarmType));
		}
	}
}
